package com.sciencep.pro.core.service;

import com.dingtalk.api.request.*;
import com.dingtalk.api.response.*;
import com.sciencep.pro.common.exception.CustomException;
import com.sciencep.pro.core.domain.dto.dingding.DingUserDetailVO;
import com.sciencep.pro.core.domain.entity.ProBaseInfo;
import com.sciencep.pro.core.domain.entity.ProjectUpdateTO;
import com.taobao.api.ApiException;

import java.util.List;

/**
 * @author libe
 * 封装DingDingAPI
 */
public interface DingDingService {


    /**
     * 获取  token
     * @param appkey
     * @param appsecret
     * @return
     * @throws Exception
     */
    String getAccessToken(String appkey,String appsecret ) throws CustomException, ApiException;


    /**
     * 根据用户ID获取用户详情
     * @param accesToken
     * @param userid
     * @return
     * @throws Exception
     */
    DingUserDetailVO getUserDetailByUserid(String accesToken, String userid) throws CustomException, ApiException;


    /**
     * 获取部门用户ID列表  offset 0是第一页
     * @param requestTO
     * @return
     * @throws Exception
     */
    List<OapiUserSimplelistResponse.Userlist> getUserSimplelist(OapiUserSimplelistRequest requestTO, String accessToken) throws CustomException, ApiException;


    /**
     * 获取子部门ID列表
     * @param id
     * @param accesToken
     * @return
     */
   List<Long> getDepartmentIdList(String id,String accesToken) throws CustomException, ApiException;


    /**
     * 获取部门列表
     * @param accestoken
     * @param lang
     * @param fetchChild
     * @param id
     * @return
     */
    List<OapiDepartmentListResponse.Department> getDepartmentList(String accestoken, String lang, Boolean fetchChild, String id) throws CustomException, ApiException;


    /**
     * 获取部门详情
     * @param id
     * @param accessToken
     * @return
     * @throws Exception
     */
    OapiDepartmentGetResponse getDepartmentDetail(String id, String accessToken) throws CustomException, ApiException;


    /**
     * 获取角色列表
     * @param size
     * @param offset
     * @param accessToken
     * @return
     * @throws Exception
     */
    List<OapiRoleListResponse.OpenRoleGroup> getRoleList(Long size, Long offset, String accessToken) throws CustomException, ApiException;

    /**
     * 获取角色列表(无分页)
     * @param request
     * @param accessToken
     * @return
     * @throws Exception
     */
    OapiRoleListResponse.PageVo getRoleListPage(OapiRoleListRequest request, String accessToken) throws CustomException, ApiException;

    /**
     * 获取角色下的员工列表
     * @param roid_id
     * @param size
     * @param offset
     * @param accessToken
     * @return
     * @throws Exception
     */
    OapiRoleSimplelistResponse.PageVo getRoleSimpleList(OapiRoleSimplelistRequest request, String accessToken) throws CustomException, ApiException;


    /**
     * 获取企业用户日志数据
     * @param request
     * @return
     */
    OapiReportListResponse.PageVo getReportList(OapiReportListRequest request, String accessToken) throws CustomException, ApiException;


    /**
     * 获取用户可见的日志模板
     * @param userid
     * @param offset
     * @param size
     * @return
     */
    OapiReportTemplateListbyuseridResponse.HomePageReportTemplateVo getReportTemplateListByUserId(String userid, Long offset, Long size, String accessToken) throws CustomException, ApiException;


    /**
     * 获取打卡结果
     * @param request
     * @return
     * @throws Exception
     */
    List<OapiAttendanceListResponse.Recordresult> getAttendanceList(OapiAttendanceListRequest request, String token) throws CustomException, ApiException;


    /**
     * 获取打卡详情
     * @param request
     * @param token
     * @return
     */
    List<OapiAttendanceListRecordResponse.Recordresult> getAttendanceListRecord(OapiAttendanceListRecordRequest request , String token) throws CustomException, ApiException;


    /**
     * 查询请假状态
     * @param req
     * @param token
     * @return
     */
    OapiAttendanceGetleavestatusResponse.LeaveStatusListVO getLeaveStatus(OapiAttendanceGetleavestatusRequest req, String token ) throws CustomException, ApiException;


    /**
     * 获取员工花名册字段信息
     * @param userIdList
     * @param fieldFilterList
     * @param accessToken
     * @return
     */
    List<OapiSmartworkHrmEmployeeListResponse.EmpFieldInfoVO> getHrmEmployeeList(String userIdList, String fieldFilterList, String accessToken) throws CustomException, ApiException;


    /**
     * 查询在职员工userid列表
     * @param statusList
     * @param offset
     * @param size
     * @param token
     * @return
     */
    OapiSmartworkHrmEmployeeQueryonjobResponse.PageResult getEmployeeQuerynjob(String statusList, Long offset, Long size, String token) throws CustomException, ApiException;


    /**
     * 分页查询企业离职员工userid列表。
     * @param offset
     * @param size
     * @param token
     * @return
     */
    OapiSmartworkHrmEmployeeQuerydimissionResponse.Paginator getEmployeeDimission(Long offset, Long size, String token) throws CustomException, ApiException;


    /**
     * 创建新项目审批流程
     * @param proBaseInfo
     */
    void createProcessInstance(ProBaseInfo proBaseInfo,String token,String userId) throws ApiException;


    /**项目变更提交审批
     *
     * @param projectUpdateTO
     * @param token
     * @param userId
     * @throws Exception
     */
    void createProjectUpdateProcessInstance(ProjectUpdateTO projectUpdateTO, String token, String userId) throws ApiException;

    /**
     * 获取审批结果
     * @param id
     * @return
     */
    OapiProcessinstanceGetResponse.ProcessInstanceTopVo getProcessResult(String id,String token) throws ApiException, CustomException;
}
